/*
 * Copyright (c) 2006, 2023, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import java.util.stream.Stream;

/**
 * <p>Project: jse2302 - Stream4
 * <p>Powered by webrx On 2023-06-29 11:14:09
 * <p>Created by IntelliJ IDEA
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Stream4 {
    public static void main(String[] args) {
        Stream<Integer> is1 = Stream.of(12, 10, 31, 1, 1, 1, 1, 2, 3, 4, 2, 5);
        is1.distinct().sorted().forEach(System.out::println);
        Stream<Integer> is2 = Stream.of(12, 10, 31, 1, 1, 1, 1, 2, 3, 4, 2, 5);
        is2.distinct().sorted((a, b) -> b - a).forEach(System.out::println);
        Stream<Integer> is3 = Stream.of(12, 10, 31, 1, 1, 1, 1, 2, 3, 4, 2, 5);
        is3.distinct().sorted((a, b) -> Math.random() > .5 ? 1 : -1).forEach(System.out::println);
    }
}
